package com.cn.jx.manager.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cn.jx.common.controller.BaseController;
import com.cn.jx.common.util.jpaQuery.ConvertCondition;
import com.cn.jx.common.util.jpaQuery.QueryCondition;
import com.cn.jx.common.util.page.PageObj;
import com.cn.jx.manager.service.query.IAnalysisServiceQry;
import com.jx.enumType.DataGrideTypeEnum;
import com.jx.util.MapObject;
import com.jx.util.Utility;

/**
 * 
 * @author 姜旭f
 * @version v1.11.20.2019
 * @since 
 * <p>创建时间：2019年12月5日
 * <p>功能描述：统计分析
 * <p>官方网站：management/admin/index
 * <p>邮箱地址：524577360@qq.com
 */
@Controller
@RequestMapping("/admin/analysis/")
public class AnalysisController extends BaseController{

	@Autowired
	private IAnalysisServiceQry analysisServiceQry;
	
	/**
	 * 
	* @Title: operatorLog
	* @Description: TODO(操作日志)
	* <p>邮箱地址：524577360@qq.com
	* @throws
	 */
	 @RequestMapping("operator/log")
	 public String operatorLog(Model model) {
		 setModelColumns(model, DataGrideTypeEnum.OPERT_LOG);
		 return "system/operatLog";
	 }
	 
	 /**
	  * 
	 * @Title:logList
	 * @Description:TODO(日志分页查询)
	 * <p>邮箱地址: 524577360@qq.com
	 * PageObj<MapObject>
	 * @throws
	  */
	@RequestMapping("listData/{path}")
	@ResponseBody
	public PageObj<MapObject> logList(Model model, Integer page, Integer rows, String sort, String order, String param) {
		if(Utility.isBlank(sort)){
			sort="operatTime";
			order="DESC";
		}
		QueryCondition cond = ConvertCondition.initCondition(page, rows, sort, order, param, "page");
		cond.setNocondition(true);
		try {
			PageObj<MapObject> pageuser = analysisServiceQry.findOperLogByPageAndParams(cond);
			return pageuser;
		} catch (Exception e) {
			log.debug(e.getMessage());
			e.printStackTrace();
		}
		return null;
	}
}
